import java.net.ServerSocket;
import java.net.Socket;


public class Server extends Thread{
	private ServerSocket dateServer;
	public static void main(String argv[]) throws Exception {
		Pcap obj=new Pcap();
		obj.runDump();
		
		//new Server();
	}
	public Server() throws Exception {
		dateServer = new ServerSocket(3000);
		System.out.println("Server listening on port 3000.");
		this.start();
	}
	public void run() {
		while (true) {
			try {
				System.out.println("Waiting for connections.");
				Socket client = dateServer.accept();
				System.out.println("Accepted a connection from: "
						+ client.getInetAddress());
				Connection connection = new Connection(client);
				connection.sendMessage("Server says HI!");
			} catch (Exception e) {
				System.out.println(e);
			}
		}
	}
}
